home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Development / Interfaces / QD3DView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-14  |  11.0 KB  |  358 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DView.h                                                 **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:     View types and routines                                     **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1992-1995 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DView_h
  15. #define QD3DView_h
  16.  
  17. #ifndef QD3D_h
  18. #include <QD3D.h>
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #if defined(__MWERKS__)
  26.     #pragma enumsalwaysint on
  27.     #pragma align_array_members off
  28.     #pragma options align=native
  29. #endif
  30.  
  31. #include <QD3DStyle.h>
  32. #include <QD3DSet.h>
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif    /* __cplusplus */
  37.  
  38.  
  39. /******************************************************************************
  40.  **                                                                             **
  41.  **                        View Type Definitions                                 **
  42.  **                                                                             **
  43.  *****************************************************************************/
  44.  
  45. typedef enum TQ3ViewStatus {
  46.     kQ3ViewStatusDone,
  47.     kQ3ViewStatusRetraverse,
  48.     kQ3ViewStatusError,
  49.     kQ3ViewStatusCancelled
  50. } TQ3ViewStatus;
  51.  
  52.  
  53. /******************************************************************************
  54.  **                                                                             **
  55.  **                        Default Attribute Set                                 **
  56.  **                                                                             **
  57.  *****************************************************************************/
  58.  
  59. #define kQ3ViewDefaultAmbientCoefficient    1.0
  60. #define kQ3ViewDefaultDiffuseColor            0.5, 0.5, 0.5
  61. #define kQ3ViewDefaultSpecularColor            0.5, 0.5, 0.5
  62. #define kQ3ViewDefaultSpecularControl        4.0
  63. #define kQ3ViewDefaultTransparency            1.0, 1.0, 1.0
  64. #define kQ3ViewDefaultHighlightColor        1.0, 0.0, 0.0
  65.  
  66. #define kQ3ViewDefaultSubdivisionMethod        kQ3SubdivisionMethodConstant
  67. #define kQ3ViewDefaultSubdivisionC1            10.0
  68. #define kQ3ViewDefaultSubdivisionC2            10.0
  69.  
  70.  
  71. /******************************************************************************
  72.  **                                                                             **
  73.  **                            View Routines                                     **
  74.  **                                                                             **
  75.  *****************************************************************************/
  76.  
  77. QD3D_EXPORT TQ3ViewObject Q3View_New(
  78.     void);
  79.  
  80. QD3D_EXPORT TQ3Status Q3View_Cancel(
  81.     TQ3ViewObject        view);
  82.  
  83. /******************************************************************************
  84.  **                                                                             **
  85.  **                        View Rendering routines                                 **
  86.  **                                                                             **
  87.  *****************************************************************************/
  88.  
  89. QD3D_EXPORT TQ3Status Q3View_SetRendererByType(
  90.     TQ3ViewObject         view,
  91.     TQ3ObjectType         type);
  92.     
  93. QD3D_EXPORT TQ3Status Q3View_SetRenderer(
  94.     TQ3ViewObject         view,
  95.     TQ3RendererObject    renderer);
  96.  
  97. QD3D_EXPORT TQ3Status Q3View_GetRenderer(
  98.     TQ3ViewObject        view,
  99.     TQ3RendererObject    *renderer);
  100.     
  101. QD3D_EXPORT TQ3Status Q3View_StartRendering(
  102.     TQ3ViewObject         view);
  103.     
  104. QD3D_EXPORT TQ3ViewStatus Q3View_EndRendering(
  105.     TQ3ViewObject         view);
  106.     
  107. QD3D_EXPORT TQ3Status Q3View_Flush(
  108.     TQ3ViewObject        view);
  109.     
  110. QD3D_EXPORT TQ3Status Q3View_Sync(
  111.     TQ3ViewObject        view);
  112.  
  113.  
  114. /******************************************************************************
  115.  **                                                                             **
  116.  **                        View/Bounds/Pick routines                             **
  117.  **                                                                             **
  118.  *****************************************************************************/
  119.  
  120. QD3D_EXPORT TQ3Status Q3View_StartBoundingBox(
  121.     TQ3ViewObject        view,
  122.     TQ3ComputeBounds    computeBounds);
  123.  
  124. QD3D_EXPORT TQ3ViewStatus Q3View_EndBoundingBox(
  125.     TQ3ViewObject        view,
  126.     TQ3BoundingBox        *result);
  127.  
  128. QD3D_EXPORT TQ3Status Q3View_StartBoundingSphere(
  129.     TQ3ViewObject        view,
  130.     TQ3ComputeBounds    computeBounds);
  131.  
  132. QD3D_EXPORT TQ3ViewStatus Q3View_EndBoundingSphere(
  133.     TQ3ViewObject        view,
  134.     TQ3BoundingSphere    *result);
  135.  
  136. QD3D_EXPORT TQ3Status Q3View_StartPicking(
  137.     TQ3ViewObject        view,
  138.     TQ3PickObject        pick);
  139.  
  140. QD3D_EXPORT TQ3ViewStatus Q3View_EndPicking(
  141.     TQ3ViewObject        view);
  142.  
  143.  
  144. /******************************************************************************
  145.  **                                                                             **
  146.  **                            View/Camera routines                             **
  147.  **                                                                             **
  148.  *****************************************************************************/
  149.  
  150. QD3D_EXPORT TQ3Status Q3View_GetCamera(
  151.     TQ3ViewObject        view,
  152.     TQ3CameraObject        *camera);
  153.  
  154. QD3D_EXPORT TQ3Status Q3View_SetCamera(
  155.     TQ3ViewObject        view,
  156.     TQ3CameraObject        camera);
  157.  
  158.  
  159. /******************************************************************************
  160.  **                                                                             **
  161.  **                            View/Lights routines                             **
  162.  **                                                                             **
  163.  *****************************************************************************/
  164.  
  165. QD3D_EXPORT TQ3Status Q3View_SetLightGroup(
  166.     TQ3ViewObject        view,
  167.     TQ3GroupObject        lightGroup);
  168.  
  169. QD3D_EXPORT TQ3Status Q3View_GetLightGroup(
  170.     TQ3ViewObject        view,
  171.     TQ3GroupObject        *lightGroup);
  172.  
  173.  
  174. /******************************************************************************
  175.  **                                                                             **
  176.  **        Idle Method                                                             **
  177.  **                                                                             **
  178.  **        These allow the application to register callback routines which will **
  179.  **        be called by the view during especially long operations.             **
  180.  **                                                                             **
  181.  **        These are used to interrupt long renderings or traversals.  Inside     **
  182.  **        the idler callback the application can check for command-period or     **
  183.  **        whatever else they may be using to let the user interrupt rendering. **
  184.  **                                                                             **
  185.  **        It is NOT LEGAL to call QD3D routines inside an idler callback.         **
  186.  **        Return kQ3Failure to cancel rendering.                                 **
  187.  **                                                                             **
  188.  **        Q3View_SetIdleMethod registers a callback that can be called         **
  189.  **        by the system during rendering.  Unfortunately there is no way yet     **
  190.  **        to set timer intervals when you want to be called.  Basically, it is **
  191.  **        up to the application's idler callback to check clocks to see if you **
  192.  **        were called back only a millisecond ago or an hour ago!                 **
  193.  **                                                                             **
  194.  *****************************************************************************/
  195.  
  196. typedef TQ3Status (*TQ3ViewIdleMethod)(
  197.     TQ3ViewObject        view,
  198.     const void            *idlerData);
  199.  
  200. QD3D_EXPORT TQ3Status Q3View_SetIdleMethod(
  201.     TQ3ViewObject        view,
  202.     TQ3ViewIdleMethod    idleMethod,
  203.     const void             *idleData);
  204.  
  205.  
  206. /******************************************************************************
  207.  **                                                                             **
  208.  **                            Push/Pop routines                                 **
  209.  **                                                                             **
  210.  *****************************************************************************/
  211.  
  212. QD3D_EXPORT TQ3Status Q3Push_Submit(
  213.     TQ3ViewObject     view);
  214.  
  215. QD3D_EXPORT TQ3Status Q3Pop_Submit(
  216.     TQ3ViewObject     view);
  217.  
  218.  
  219. /******************************************************************************
  220.  **                                                                             **
  221.  **        Check if bounding box is visible in the viewing frustum.  Transforms **
  222.  **        the bbox by the current local_to_world transformation matrix and     **
  223.  **        does a clip test to see if it lies in the viewing frustum.             **
  224.  **        This can be used by applications to cull out large chunks of scenes     **
  225.  **        that are not going to be visible.                                     **
  226.  **                                                                             **
  227.  **        The default implementation is to always return kQ3True.  Renderers     **
  228.  **        may override this routine however to do the checking.                 **
  229.  **                                                                             **
  230.  *****************************************************************************/
  231.  
  232. QD3D_EXPORT TQ3Boolean Q3View_IsBoundingBoxVisible(
  233.     TQ3ViewObject            view,
  234.     const TQ3BoundingBox    *bbox);
  235.  
  236.  
  237. /******************************************************************************
  238.  **                                                                             **
  239.  **                            DrawContext routines                             **
  240.  **                                                                             **
  241.  *****************************************************************************/
  242.  
  243. QD3D_EXPORT TQ3Status Q3View_SetDrawContext(
  244.     TQ3ViewObject             view,
  245.     TQ3DrawContextObject    drawContext);
  246.  
  247. QD3D_EXPORT TQ3Status Q3View_GetDrawContext(
  248.     TQ3ViewObject             view,
  249.     TQ3DrawContextObject    *drawContext);
  250.  
  251.  
  252. /******************************************************************************
  253.  **                                                                             **
  254.  **                            Graphics State routines                             **
  255.  **                                                                             **
  256.  ** The graphics state routines can only be called while rendering (ie. in     **
  257.  ** between calls to start and end rendering calls).  If they are called     **
  258.  ** outside of a rendering loop, they will return with error.                 **
  259.  **                                                                             **
  260.  *****************************************************************************/
  261.   
  262. /******************************************************************************
  263.  **                                                                             **
  264.  **                            Transform routines                                 **
  265.  **                                                                             **
  266.  *****************************************************************************/
  267.  
  268. QD3D_EXPORT TQ3Status Q3View_GetLocalToWorldMatrixState(
  269.     TQ3ViewObject        view,
  270.     TQ3Matrix4x4        *matrix);
  271.         
  272. QD3D_EXPORT TQ3Status Q3View_GetWorldToFrustumMatrixState(
  273.     TQ3ViewObject        view,
  274.     TQ3Matrix4x4        *matrix);
  275.         
  276. QD3D_EXPORT TQ3Status Q3View_GetFrustumToWindowMatrixState(
  277.     TQ3ViewObject        view,
  278.     TQ3Matrix4x4        *matrix);
  279.     
  280.  
  281. /******************************************************************************
  282.  **                                                                             **
  283.  **                            Style state routines                             **
  284.  **                                                                             **
  285.  *****************************************************************************/
  286.  
  287. QD3D_EXPORT TQ3Status Q3View_GetBackfacingStyleState(
  288.     TQ3ViewObject            view,
  289.     TQ3BackfacingStyle        *backfacingStyle);
  290.  
  291. QD3D_EXPORT TQ3Status Q3View_GetInterpolationStyleState(
  292.     TQ3ViewObject            view,
  293.     TQ3InterpolationStyle    *interpolationType);
  294.  
  295. QD3D_EXPORT TQ3Status Q3View_GetFillStyleState(
  296.     TQ3ViewObject            view,
  297.     TQ3FillStyle            *fillStyle);
  298.  
  299. QD3D_EXPORT TQ3Status Q3View_GetHighlightStyleState(
  300.     TQ3ViewObject            view,
  301.     TQ3AttributeSet            *highlightStyle);
  302.  
  303. QD3D_EXPORT TQ3Status Q3View_GetSubdivisionStyleState(
  304.     TQ3ViewObject            view,
  305.     TQ3SubdivisionStyleData    *subdivisionStyle);
  306.  
  307. QD3D_EXPORT TQ3Status Q3View_GetOrientationStyleState(
  308.     TQ3ViewObject            view,
  309.     TQ3OrientationStyle        *fontFacingDirectionStyle);
  310.  
  311. QD3D_EXPORT TQ3Status Q3View_GetReceiveShadowsStyleState(
  312.     TQ3ViewObject            view,
  313.     TQ3Boolean                *receives);
  314.  
  315. QD3D_EXPORT TQ3Status Q3View_GetPickIDStyleState(
  316.     TQ3ViewObject            view,
  317.     unsigned long            *pickIDStyle);
  318.     
  319. QD3D_EXPORT TQ3Status Q3View_GetPickPartsStyleState(
  320.     TQ3ViewObject            view,
  321.     TQ3PickParts            *pickPartsStyle);
  322.  
  323.  
  324. /******************************************************************************
  325.  **                                                                             **
  326.  **                        Attribute state routines                             **
  327.  **                                                                             **
  328.  *****************************************************************************/
  329.  
  330. QD3D_EXPORT TQ3Status Q3View_GetDefaultAttributeSet(
  331.     TQ3ViewObject        view,
  332.     TQ3AttributeSet        *attributeSet);
  333.  
  334. QD3D_EXPORT TQ3Status Q3View_SetDefaultAttributeSet(
  335.     TQ3ViewObject        view,
  336.     TQ3AttributeSet        attributeSet);
  337.  
  338.  
  339. QD3D_EXPORT TQ3Status Q3View_GetAttributeSetState(
  340.     TQ3ViewObject         view,
  341.     TQ3AttributeSet        *attributeSet);
  342.  
  343. QD3D_EXPORT TQ3Status Q3View_GetAttributeState(
  344.     TQ3ViewObject         view,
  345.     TQ3AttributeType    attributeType,
  346.     void                *data);
  347.     
  348. #ifdef __cplusplus
  349. }
  350. #endif    /* __cplusplus */
  351.  
  352. #if defined(__MWERKS__)
  353. #pragma options align=reset
  354. #pragma enumsalwaysint reset
  355. #endif
  356.  
  357. #endif  /*  QD3DView_h  */
  358.